AT Protocol demo scripts#461
Draft
cassidyjames wants to merge 19 commits into
Draft
Conversation
This comment has been minimized.
This comment has been minimized.
Replace the placeholder `authorHandle: did` with separate `did`, `handle`, and `displayName` fields populated via the Bluesky public profile API. Profiles are cached per-DID to avoid redundant lookups. Also renames the item types in atproto-setup from "Bluesky" to "atproto" and adds `did` and `displayName` to the post schema.
c43ca56 to
2bd8450
Compare
# Conflicts: # README.md # server/package.json
Collect a random cross-section of up to 20 posts from the firehose using reservoir-style replacement. Sampling is independent of the item rate limit so the buffer stays populated even when throughput is high. This is groundwork for the report submission added next.
Picks a random post from the sample buffer every 60 seconds and submits it to /api/v1/report using the post's author DID as the reporter. Requires --user-type-id (from atproto:setup). Reports are skipped gracefully if the arg is omitted. Dry-run mode supported.
Reports now go through the same token-bucket pattern as items: each incoming post attempts to consume a report token, with a configurable --report-rate-limit flag (default: 1/min). This removes the sample buffer and the fixed setInterval in favor of something simpler and more flexible.
bsky.app blocks direct embedding (X-Frame-Options: SAMEORIGIN), so the review iframe needs a proxy. atproto-proxy.mts is a minimal Node HTTP server (port 4000) that fetches post data from the Bluesky public API and renders it as a standalone HTML page, including postMessage support for the review UI's blur/grayscale wellness settings. Also documents VITE_CONTENT_URL_PATTERN=bsky.app as required in client/.env for Bluesky URLs to trigger the iframe in the first place.
Adds five optional embed fields to the atproto Post item type schema (embedType, embedUrl, embedTitle, embedDescription, embedThumb) so Coop rules can match on linked URLs and link preview content. Also adds --post-type-id / --user-type-id flags to atproto-setup so it can be run against an existing org to update item types rather than always creating new ones. Passes the full schema on update to avoid relying on merge behavior. Fixes "Bluesky" → "AT Protocol" in user-facing strings in the setup script and README.
Extends BlueskyPost and CoopItem to capture embed data from raw AT Protocol firehose records. postToCoopItem() now maps embedType for all embed types, and embedUrl/embedTitle/embedDescription for external link embeds. embedThumb is omitted since blob URLs aren't resolved in raw firehose records. Also fixes "Bluesky" → "atproto" / "AT Protocol" in comments and option descriptions.
Adds renderEmbed() to the proxy, handling all five AT Protocol embed types: external link cards (thumbnail, title, description, hostname), image grids (up to 4 images, 1- or 2-column), video thumbnails with play overlay, quoted posts, and recordWithMedia. Unknown embed types return empty string for forward compatibility. Also fixes "Bluesky" → "atproto"/"bsky.app" terminology in the proxy's user-facing strings.
Applying the filter to `document.body` blurred the entire iframe—text, author name, card border, everything. Targeting only `img` elements via a CSS custom property (`--img-filter`) keeps text and layout readable while still blurring images and video/link card thumbnails.
Moderators need a way to reveal blurred images without toggling the blur setting entirely. Hovering over an image now temporarily removes the filter, with the existing transition making the reveal smooth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is my branch I've been using for demos locally and on Codespace. It adds two scripts:
My goal is for this branch to track
mainand not touch anything else in the codebase besides these scripts to keep things self-contained and reproducible.Usage:
Create the item types (run once after
npm run create-org):Copy the item type ID printed at the end.
Start the firehose connector (in a separate terminal):
Posts from the Bluesky firehose will be processed by automated rules as they arrive. The connector defaults to 100 submissions per minute; pass
--rate-limit <n>to adjust. Use--dry-runto preview submissions without sending them.There's probably a lot that can be improved, hence the draft status; I'm just opening this PR for visibility for now. :) Off the top of my head: